﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Collections;
using PhatPhucLoc.dao;
using PhatPhucLoc.model;

namespace PhatPhucLoc.view
{
    public partial class FormLoiNhuanKhachHang : Form
    {
        private ArrayList arr = new ArrayList();

        public FormLoiNhuanKhachHang()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            arr.Clear();
            DateTime start = dtpStart.Value;
            DateTime end = dtpEnd.Value;

            arr = ReportDAO.GetLoiNhuanKhachHang(start, end, int.Parse(cbbNhomhang.SelectedValue.ToString()));
            if (arr.Count > 0)
            {
                FormReportLoiNhuan frm = new FormReportLoiNhuan(1);
                frm.ds = arr;
                frm.Show();
            }
            else
                MessageBox.Show("Vẫn chưa bán sản phẩm");
            //MessageBox.Show(start.ToShortDateString());
        }

        private void FormLoiNhuanNhomHang_Load(object sender, EventArgs e)
        {
            DataTable dt = KhachHangDAO.KhachHang_GetAll();
            cbbNhomhang.DisplayMember = "ten";
            cbbNhomhang.ValueMember = "id";
            cbbNhomhang.DataSource = dt;
        }
    }
}
